package com.sh.read_configuration_file;

import org.yaml.snakeyaml.Yaml;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Map;

public class YamlReaderExample {
    public static void main(String[] args) {
        try {
            Yaml yaml = new Yaml();
            Map<String, Object> data = yaml.load(new FileInputStream("D:\\java_workspace\\allproject\\learn\\src\\main\\resources\\shihao.yml"));
            System.out.println("Data from YAML: " + data);
            Object o = data.get("shihao");
            Map<String, Object> shihaoMap = (Map<String, Object>) o;
            System.out.println(shihaoMap.get("name"));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }
}